package com.beautifulcity;

import de.greenrobot.daogenerator.DaoGenerator;
import de.greenrobot.daogenerator.Entity;
import de.greenrobot.daogenerator.Schema;

public class BeautifulCityDaoGenerator {

    public static void main(String args[]){
        //创建Schema对象
        //构造方法第一个参数为数据库版本号
        //第二个参数为自动生成的实体类将要存放的位置,前面是Android Module的包名
        Schema schema = new Schema(1 , "com.sxx.beautifulcity.entity.greendao");
        //添加需要创建的实体类信息
        addDatabase(schema);
        try {
            new DaoGenerator().generateAll(schema , "./app/src/main/java");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    private static void addDatabase(Schema schema){
        //指定需要生成实体类的类名,类名确定之后表明也是根据这个类名来自动命名
        /***
         * 建立农家院的表
         */
        Entity entity = schema.addEntity("AgritourismDaoEntity");
        //指定一个自增长的zhujian
        entity.addLongProperty("msgId").columnName("msgId").primaryKey().autoincrement();
        entity.addStringProperty("comment");
        entity.addStringProperty("image");
        entity.addStringProperty("name");
        entity.addStringProperty("id");
        entity.addIntProperty("star");
        /***
         * 建立景区周边的表
         */
        Entity entity_around = schema.addEntity("AroundDaoEntity");
        entity_around.addLongProperty("armsgId").columnName("armsgId").primaryKey().autoincrement();
        entity_around.addStringProperty("name");
        entity_around.addStringProperty("id");
        entity_around.addStringProperty("linksid");
        /***
         * 建立精品路线的表
         */
        Entity entity_line = schema.addEntity("LineDaoEntity");
        entity_line.addLongProperty("limsgId").columnName("limsgId").primaryKey().autoincrement();
        entity_line.addStringProperty("image");
        entity_line.addStringProperty("name");
        entity_line.addStringProperty("id");

        /***
         * 建立度假村的表
         */
        Entity entity_holiday = schema.addEntity("HolidayDaoEntity");
        //指定一个自增长的zhujian
        entity_holiday.addLongProperty("homsgId").columnName("homsgId").primaryKey().autoincrement();
        entity_holiday.addStringProperty("comment");
        entity_holiday.addStringProperty("image");
        entity_holiday.addStringProperty("name");
        entity_holiday.addStringProperty("id");
        entity_holiday.addIntProperty("star");

        /***
         * 建立采摘的表
         */
        Entity entity_pluck = schema.addEntity("PluckDaoEntity");
        //指定一个自增长的zhujian
        entity_pluck.addLongProperty("plmsgId").columnName("plmsgId").primaryKey().autoincrement();
        entity_pluck.addStringProperty("comment");
        entity_pluck.addStringProperty("image");
        entity_pluck.addStringProperty("name");
        entity_pluck.addStringProperty("id");
        entity_pluck.addIntProperty("star");
        /***
         * 建立乡村的表
         */
        Entity entity_village = schema.addEntity("VillageDaoEntity");
        //指定一个自增长的zhujian
        entity_village.addLongProperty("vimsgId").columnName("vimsgId").primaryKey().autoincrement();
        entity_village.addStringProperty("comment");
        entity_village.addStringProperty("image");
        entity_village.addStringProperty("name");
        entity_village.addStringProperty("id");
        entity_village.addIntProperty("star");
        /***
         * 建立特产的表
         */
        Entity entity_speciality = schema.addEntity("SpeciallyDaoEntity");
        //指定一个自增长的zhujian
        entity_speciality.addLongProperty("spmsgId").columnName("spmsgId").primaryKey().autoincrement();
        entity_speciality.addStringProperty("comment");
        entity_speciality.addStringProperty("image");
        entity_speciality.addStringProperty("name");
        entity_speciality.addStringProperty("id");
        entity_speciality.addIntProperty("star");
        /****
         * 建立美食的表
         */
        Entity entity_deliciousfood = schema.addEntity("DeliciousFoodDaoEntity");
        //指定一个自增长的zhujian
        entity_deliciousfood.addLongProperty("demsgId").columnName("demsgId").primaryKey().autoincrement();
        entity_deliciousfood.addStringProperty("comment");
        entity_deliciousfood.addStringProperty("image");
        entity_deliciousfood.addStringProperty("name");
        entity_deliciousfood.addStringProperty("id");
        entity_deliciousfood.addIntProperty("star");
        /***
         * 建立宠物的表
         */
        Entity entity_pet = schema.addEntity("PetDaoEntity");
        //指定一个自增长的zhujian
        entity_pet.addLongProperty("pemsgId").columnName("pemsgId").primaryKey().autoincrement();
        entity_pet.addStringProperty("comment");
        entity_pet.addStringProperty("image");
        entity_pet.addStringProperty("name");
        entity_pet.addStringProperty("id");
        entity_pet.addIntProperty("star");
        /***
         * 建立天气表
         */
        Entity entity_weather = schema.addEntity("WeatherDaoEntity");
        //指定一个自增长的zhujian
        entity_weather.addLongProperty("wemsgId").columnName("wemsgId").primaryKey().autoincrement();
        entity_weather.addStringProperty("city");
        entity_weather.addStringProperty("date");
        entity_weather.addStringProperty("weather");
        entity_weather.addStringProperty("temp");
        entity_weather.addStringProperty("l_tmp");
        entity_weather.addStringProperty("h_tmp");
        entity_weather.addStringProperty("WD");
        entity_weather.addStringProperty("WS");

        /***
         * 建立烧烤表
         */
        Entity entity_barbecue = schema.addEntity("BarbecuteDaoEntity");
        //指定一个自增长的zhujian
        entity_barbecue.addLongProperty("bamsgId").columnName("bamsgId").primaryKey().autoincrement();
        entity_barbecue.addStringProperty("comment");
        entity_barbecue.addStringProperty("image");
        entity_barbecue.addStringProperty("name");
        entity_barbecue.addStringProperty("id");
        entity_barbecue.addIntProperty("star");
        entity_barbecue.addStringProperty("Srcurl");

        /***
         * 创建养生表
         */
        Entity entity_keephealtn = schema.addEntity("KeepHealthDaoEntity");
        //指定一个自增长的zhujian
        entity_keephealtn.addLongProperty("khmsgId").columnName("khmsgId").primaryKey().autoincrement();
        entity_keephealtn.addStringProperty("city");
        entity_keephealtn.addStringProperty("date");
        entity_keephealtn.addStringProperty("weather");
        entity_keephealtn.addStringProperty("temp");
        entity_keephealtn.addStringProperty("l_tmp");
        entity_keephealtn.addStringProperty("h_tmp");
        entity_keephealtn.addStringProperty("WD");
        entity_keephealtn.addStringProperty("WS");

        /**
         * 创建用户表
         */
        Entity entity_user = schema.addEntity("UserDaoEntity");
        entity_user.addLongProperty("userId").columnName("userId").primaryKey().autoincrement();
        entity_user.addStringProperty("userName");
        entity_user.addStringProperty("userPsw");
        entity_user.addStringProperty("zhanghao");

        /**
         * 创建用户登录表
         */

        Entity entity_login_user = schema.addEntity("LoginUserDaoEntity");
        entity_login_user.addLongProperty("user_loginId").columnName("user_loginId").primaryKey().autoincrement();
        entity_login_user.addStringProperty("user_login_name");
        entity_login_user.addStringProperty("user_login_paw");
        entity_login_user.addStringProperty("zhanghao");


        /***
         *创建详情表
         */

        Entity entity_Detail = schema.addEntity("Detail");
        entity_Detail.addLongProperty("detialId").columnName("detialId").primaryKey().autoincrement();
        entity_Detail.addStringProperty("path");

    }
}
